
<h2>测试</h2>

<style>

.box02 td{background-color:#eaf8f9; border:1px #999999 solid; text-indent:20px; }
</style>
        
<div id="box01">  

<% form_for(:test, :url => { :action => "result" }) do |f|%>
  <%= error_messages_for :test %>
  <table width="940" border="0" align="center" cellpadding="0" cellspacing="5" class="box02">

      <% @test.questions.each do |question| %>
        <tr height="20">
          <td width="60%">
            <%= question.description%>
            <%= hidden_field_tag "question_id[]", question.id %> 
          </td>
          <td width="40%">
            <!--选项-->
              <%
                choices = @test.choices.sort{|a, b| b.value <=> a.value}
                for choice in choices 
              %>
                <%= radio_button("question" + question.id.to_s, "choice[value]", choice.value, :checked => choice == choices[2] ? true : false ) %>
                <%= choice.content %>         
              <% end %>
          </td>
        </tr>
      <% end %>
       
  </table>

      <br/>
      <center>
      <%= submit_tag "提交", :class => "submit" %>
      </center>
</div>

<% end %>
